package com.suixun.util.enums;

/**
 * APICodes.java
 *
 *  API相关的枚举内容
 *
 * @author <a href="mailto:huangy@17find.com">hellmash</a>
 * @version create on 2015-07-20 10:43
 *          <p>
 *          CopyRight(c)2015 杭州随寻科技有限公司 17find.com 版权所有
 */
public enum APICode0 {

    //HTTP常规code
    HTTP_200(0, "操作成功"),
    API_50006(1, "操作失败"),
    API_90000(90000, "传入参数不能为空"),
    API_90001(90001, "该用户不存在"),
    
    SUCCESS(0,"操作成功"),
    FAIL(1,"操作失败")
    
    
    
    
    ;

    private int code;

    private String msg;

    private APICode0(int _code, String _msg){
        this.code   = _code;
        this.msg    = _msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static String getNameById(int code) {
        for (APICode0 g : APICode0.values()) {
            if (g.getCode() == code) {
                return g.getMsg();
            }
        }
        return "";
    }
    
    public APICode0 setCustomMsg(String msg) {
        this.msg = msg;
        return this;
    }
}
